import { request } from './api-service';

export function getWinner(id: number) {
  return request(`winners/${id}`);
}

export function createWinner(id: number, wins: number, time: number) {
  return request(`winners`, {
    body: {
      id,
      wins,
      time,
    },
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
  });
}

export function updateWinner(id: number, wins: number, time: number) {
  return request(`winners/${id}`, {
    body: { wins, time },
    method: 'PUT',
    headers: { 'Content-Type': 'application/json' },
  });
}
